package org.now.ypos.user.dto;

import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import org.now.ypos.user.entity.User;

import java.util.List;

/**
 * UserToDtoMapper.
 *
 * <p> convert between dto and entity.
 *
 * @author wl
 * @since 2020.11.10
 */
@Mapper
public interface UserStruct {

    UserStruct INSTANCE = Mappers.getMapper(UserStruct.class);


    /**
     * convert entity to dto.
     *
     * @param entity entity
     * @return Dto
     */
    UserDto toDto(User entity);

    /**
     * convert dto to entity.
     *
     * @param dto dto
     * @return Entity
     */
    User toEntity(UserDto dto);

    /**
     * convert to dto list.
     *
     * @param userList userList
     * @return userDtoList
     */
    List<UserDto> toDtoList(List<User> userList);
}
